<div id="content" class="span10">

   <div>
    <ul class="breadcrumb">
      <li>
        <a href="<?php echo base_url('panel'); ?>">Inicio</a> <span class="divider">/</span>
      </li>
      <li>
        <a href="<?php echo base_url('panel/usuarios'); ?>">Usuarios</a> <span class="divider">/</span>
      </li>
      <li>Resumen Paquete</li>
    </ul>
  </div>

  <div class="row-fluid">
    <div class="box span4">
      <div class="box-header well" data-original-title> <!-- START BOX-HEADER -->
        <h2><i class="icon-user"></i>Información de usuario</h2>
        <div class="box-icon">
          <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
          <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
        </div>
      </div>  <!-- END BOX-HEADER -->

      <div class="box-content"> <!-- START BOX-CONTENT -->
        <address>
          <strong>Nombre:</strong> <?php echo $usuario[0]->nombre ?><br>
          <strong>Institución:</strong> <?php echo $usuario[0]->organizacion ?><br>
          <strong>Estatus:</strong> <?php if ($usuario[0]->status === '1'){$status='success'; $txt='Activo';}else{$status='important'; $txt='Eliminado';}  ?>
          <span class="label label-<?php echo $status ?>"><?php echo $txt ?></span>
        </address>

        <address>
          <strong>E-mail</strong><br>
          <a href="mailto:#"><?php echo $usuario[0]->email ?></a>
        </address>
      </div>
    </div>
  </div>


  <div class="row-fluid">
    <div class="box span12">

      <div class="box-header well" data-original-title> <!-- START BOX-HEADER -->
        <h2><i class="icon-list-alt"></i> Paquetes</h2>
        <div class="box-icon">
          <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
          <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
        </div>
      </div>  <!-- END BOX-HEADER -->

      <div class="box-content"> <!-- START BOX-CONTENT -->

        <table class="table table-striped table-bordered table-hover table-condensed"> <!-- START TABLA -->
          <!-- <caption><?php // echo $usuario; ?></caption> -->
          <thead>
            <tr>
              <th>Numero</th>
              <th>Fecha vencimiento</th>
              <th>Usuarios permitidos</th>
              <th>Tipo</th>
              <th>No. Articulos</th>
              <th>Estatus</th>
              <th>Opciones</th>
            </tr>
          </thead>
          <tbody>
            <?php foreach($paquetes['paquetes'] as $paquete) { ?>
            <tr>
              <td><?php echo $paquete->id_paquete; ?></td>
              <td><?php echo $paquete->fecha_vencimiento; ?></td>
              <td><?php echo $paquete->usuarios_permitidos; ?></td>
              <td><?php echo strtoupper($paquete->tipo); ?></td>
              <td><?php echo ($paquete->tipo === 'todo') ? 'TODOS' : $paquete->no_articulos; ?></td>
              <td>
                <?php
                  if((int)$paquete->status == 1){
                    $v_status = 'Activo';
                    $vlbl_status = 'label-success';
                  }else{
                    $v_status = 'Pendiente';
                    $vlbl_status = 'label-warning';
                  }
                ?>
                <span class="label <?php echo $vlbl_status; ?>"><?php echo $v_status; ?></span>
              </td>
              <td>
                  <?php if ($paquete->status == 0) {?>
                    <a class="btn btn-success" href="<?php echo base_url('panel/paquetes/activar/?id='.$_GET['id'].'&idp='.$paquete->id_paquete); ?>" onclick="msb.confirm('Estas seguro de activar el paquete?', 'Usuarios', this); return false;">
                      <i class="icon-zoom-in icon-white"></i>
                      Activar</a>
                  <?php } ?>
                  <a class="btn btn-danger" href="<?php echo base_url('panel/paquetes/eliminar/?id='.$_GET['id'].'&idp='.$paquete->id_paquete); ?>" onclick="msb.confirm('Estas seguro de eliminar el paquete definitivamente? <strong>No se podra revertir la acción</strong>.', 'Usuarios', this); return false;">
                    <i class="icon-trash icon-white"></i>
                    Eliminar</a>
              </td>
            </tr>
            <?php } ?>
          </tbody>
        </table> <!-- END TABLA -->

         <?php
          //Paginacion
          $this->pagination->initialize(array(
              'base_url'      => base_url($this->uri->uri_string()).'?'.String::getVarsLink(array('pag')).'&',
              'total_rows'    => $paquetes['total_rows'],
              'per_page'      => $paquetes['items_per_page'],
              'cur_page'      => $paquetes['result_page']*$paquetes['items_per_page'],
              'page_query_string' => TRUE,
              'num_links'     => 1,
              'anchor_class'  => 'pags corner-all',
              'num_tag_open'  => '<li>',
              'num_tag_close' => '</li>',
              'cur_tag_open'  => '<li class="active"><a href="#">',
              'cur_tag_close' => '</a></li>'
          ));
          $pagination = $this->pagination->create_links();
          echo '<div class="pagination pagination-centered"><ul>'.$pagination.'</ul></div>';
        ?>

      </div> <!-- END BOX-CONTENT -->
    </div>
  </div>

  <div class="row-fluid">
    <div class="box span12">

      <div class="box-header well" data-original-title> <!-- START BOX-HEADER -->
        <h2><i class="icon-list-alt"></i> Articulos visitados</h2>
        <div class="box-icon">
          <a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
          <a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
        </div>
      </div>  <!-- END BOX-HEADER -->

      <div class="box-content"> <!-- START BOX-CONTENT -->

        <form action="<?php echo base_url('panel/paquetes/resumen/'); ?>" method="get" id="frm_chvisitas" class="form-search">
          <div class="form-actions center">
            <input type="hidden" name="id" value="<?php echo $this->input->get('id'); ?>">
            <label for="ffecha_ini">Del</label> 
            <input type="text" name="ffecha_ini" id="ffecha_ini" value="<?php echo set_value_get('ffecha_ini'); ?>" class="input-small datepicker">
            
            <label for="ffecha_fin">Al</label> 
            <input type="text" name="ffecha_fin" id="ffecha_fin" value="<?php echo set_value_get('ffecha_fin'); ?>" class="input-small datepicker">
            
            <input type="submit" name="enviar" value="Enviar" class="btn">
          </div>
        </form>

        <table class="table table-striped table-bordered table-hover table-condensed"> <!-- START TABLA -->
          <!-- <caption><?php // echo $usuario; ?></caption> -->
          <thead>
            <tr>
              <th>Numero</th>
              <th>Titulo</th>
              <th>Tipo</th>
              <th>Visitas</th>
            </tr>
          </thead>
          <tbody>
            <?php foreach($visitas['articulos'] as $paquete) { ?>
            <tr>
              <td><?php echo $paquete->numero; ?></td>
              <td><?php echo $paquete->titulo; ?></td>
              <td><?php echo $paquete->nombre; ?></td>
              <td><?php echo $paquete->visitas; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table> <!-- END TABLA -->

         <?php
          //Paginacion
          $this->pagination->initialize(array(
              'base_url'      => base_url($this->uri->uri_string()).'?'.String::getVarsLink(array('pag')).'&',
              'total_rows'    => $paquetes['total_rows'],
              'per_page'      => $paquetes['items_per_page'],
              'cur_page'      => $paquetes['result_page']*$paquetes['items_per_page'],
              'page_query_string' => TRUE,
              'num_links'     => 1,
              'anchor_class'  => 'pags corner-all',
              'num_tag_open'  => '<li>',
              'num_tag_close' => '</li>',
              'cur_tag_open'  => '<li class="active"><a href="#">',
              'cur_tag_close' => '</a></li>'
          ));
          $pagination = $this->pagination->create_links();
          echo '<div class="pagination pagination-centered"><ul>'.$pagination.'</ul></div>';
        ?>

      </div> <!-- END BOX-CONTENT -->
    </div>
  </div>

</div>




<!-- Bloque de alertas -->
<?php if(isset($frm_errors)){
  if($frm_errors['msg'] != ''){
?>
<script type="text/javascript" charset="UTF-8">
  $(document).ready(function(){
    noty({"text":"<?php echo $frm_errors['msg']; ?>", "layout":"topRight", "type":"<?php echo $frm_errors['ico']; ?>"});
  });
</script>
<?php }
}?>
<!-- Bloque de alertas -->